﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Supermarket.Web.CashierPages.Inquires
{
    public partial class AllSales : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                CalendarFromDate.SelectedDate = DateTime.Now - TimeSpan.FromDays(7);
                TextBoxFromDate.Text = CalendarFromDate.SelectedDate.Date.ToString("d");  
                CalendarToDate.SelectedDate = DateTime.Now;
                TextBoxToDate.Text = CalendarToDate.SelectedDate.Date.ToString("d");
            }
        }
                
        protected void ImageButtonFromDate_Click(object sender, EventArgs eventArgs)
        {
            if (!calendarFrom.Visible)
            {
                calendarFrom.Visible = !calendarFrom.Visible;
            }
        }

        protected void CalendarFromDate_SelectionChanged(object sender, EventArgs eventArgs)
        {
            TextBoxFromDate.Text = CalendarFromDate.SelectedDate.Date.ToString("d");                        
            calendarFrom.Visible = false;
            TextBoxToDate.Focus();
        }

        protected void ImageButtonToDate_Click(object sender, EventArgs eventArgs)
        {
            if (!calendarTo.Visible)
            {
                calendarTo.Visible = !calendarTo.Visible;
            }
        }

        protected void CalendarToDate_SelectionChanged(object sender, EventArgs eventArgs)
        {
            TextBoxToDate.Text = CalendarToDate.SelectedDate.Date.ToString("d");
            calendarTo.Visible = false;
        }
    }
}